home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
embedded
/
develop
/
libsrc11.arc
/
STARTUP.S
< prev
next >
Wrap
Text File
|
1989-04-27
|
2KB
|
78 lines
******************************************************************************
* startup.s 3.3 1/2/86
*
* 68HC11 CROSS C COMPILER RUN-TIME LIBRARY
*
* (c) Copyright 1984, Motorola, Inc.
*
* FUNCTION NAME: .startup
*
* ACTION: Do the initialization of global and static variables.
* Set the stack pointer to the value defined in the
* 68HC11 linkmap.
* When control is returned from MAIN then a BRA *
* instruction is invoked.
*
* REGISTERS AND STACK:
*
* ON ENTRY: No guaranteed values
*
* SP: Undefined
*
* This routine assumes that the linkmap has the following
* symbols defined l__PSINS, l__PSINE, and l__DSINS.
* They are assumed to be defined around ipsct
* in the following way:
*
* l__PSINS = .;
* ipsct : {}
* l__PSINE = .-1;
*
* and after idsct as follows:
*
* idsct : {}
* l__DSINE = .-1;
*
*
* ON CALL TO MAIN:
* X: Undefined
*
* STACK:
* Return Address
*
* SP: The location defined by l__STKHI in the linkmap
*
* IDSCT: All global and static variables initialized.
*
*
******************************************************************************
xref l__DSINE
xref l__PSINS
xref l__PSINE
xref ..stret
dsct
xdef .stretp
.stretp:
rmb 2
psct
xdef .startup
.startup:
lds #l__DSINE Load end addr of the initialized data area
ldx #l__PSINE Load end addr of the initialization constants
loop: cpx #l__PSINS Compare to base addr of init constants
blo initdone
ldaa 0,%x load the init constant
psha store into the data area (idsct)
dex decrement the base pointer
bra loop
initdone:
lds #l__STKHI Load the stack pointer with the start of stack
ldd #..stret Initialize structure return area pointer
std .stretp
jsr main Jump to the user program
here:
bra here Cease processing, go into an infinite loop
end